package cn.dong.oss.handler;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class OssHandler implements InitializingBean {

    @Value("${alibaba.oss.endpoint}")
    private String endpoint;
    @Value("${alibaba.oss.accessKeyId}")
    private String accessKeyId;
    @Value("${alibaba.oss.accessKeySecret}")
    private String accessKeySecret;
    @Value("${alibaba.oss.bucketName}")
    private String bucketName;
    @Value("${alibaba.oss.bucketDomain}")
    private String bucketDomain;

    public static String ENDPOINT_INFO;
    public static String ACCESS_KEY_ID_INFO;
    public static String ACCESS_KEY_SECRET_INFO;
    public static String BUCKET_NAME_INFO;
    public static String BUCKET_DOMAIN_INFO;

    public void afterPropertiesSet() throws Exception {
        ENDPOINT_INFO = endpoint;
        ACCESS_KEY_ID_INFO = accessKeyId;
        ACCESS_KEY_SECRET_INFO = accessKeySecret;
        BUCKET_NAME_INFO = bucketName;
        BUCKET_DOMAIN_INFO = bucketDomain;
    }
}
